package org.com.Config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// 在配置类或主应用类中添加
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Value("${imgurl.path}")
    private String imagePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/shop/imgs/**")
                .addResourceLocations("file:" + imagePath + "/");
    }
}